<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/include/header.jsp"%>
<style type="text/css">
.date_txt,.input_txt{
	width: 90%;
}
</style>
</head>
<body>
	<div class="dialog_main">
		<div class="b_box" style="padding: 10px">
			<form id="zhangTaoForm" action="post">
				<input type="hidden" name="CSRFToken" value="${csrfToken}" />
				<input type="hidden" name="uuid" value="${zhangTao.uuid}" />
				<table class="c_table">
					<tr>
						<td class="t_tit">企业名称</td>
						<td><input type="text" id="qymc" name="qymc" class="input_txt" data-validaterole="qymc" value="${zhangTao.qymc }" /></td>
						<td class="t_tit">本位币</td>
						<td><input type="text" id="bwb" class="input_txt" data-validaterole="bwb" readonly="readonly" style="background-color: #ccc;" value="${zhangTao.bwb }" /></td>
					</tr>
					<tr>
						<td class="t_tit">启用年份</td>
						<td><input type="text" id="qyYear" class="input_txt" readonly="readonly" style="background-color: #ccc;" data-validaterole="qyYear" value="${zhangTao.qyYear }年" /></td>
						<td class="t_tit">启用月份</td>
						<td><input type="text" id="qyMonth" class="input_txt" readonly="readonly" style="background-color: #ccc;" data-validaterole="qyMonth" value="${zhangTao.qyMonth }月" /></td>
					</tr>
					<tr>
						<td class="t_tit">纳税人名称</td>
						<td><input type="text" id="nsrmc" name="nsrmc" class="input_txt" value="${zhangTao.nsrmc }" /></td>
						<td class="t_tit">纳税人识别号</td>
						<td><input type="text" id="nsrcbh" name="nsrcbh" class="input_txt" value="${zhangTao.nsrcbh }" /></td>
					</tr>
					<tr>
						<td class="t_tit">会计制度</td>
						<td colspan="3">
							<select id="kzzd" disabled="disabled" class="input_txt" data-validaterole="kzzd" style="width: 97%;background-color: #ccc;">
								<option value="${zhangTao.kzzd }">${zhangTao.kzzd }</option>
							</select>
						</td>
					</tr>
				</table>			
			</form>
		</div>
		<div class="action_box t_c">
			<input type="button" class="a_btn" id="addBtn" value="保存" />
		</div>
	</div>

	<script type="text/javascript">
	// 验证
	seajs.use(["component/validate", "component/tip"], function(validate, tip) {
		var ntip = function () {
			// 定义一个提示对象
			var t = new tip({
				content : 'hello tip', hasArrow : true, arrowOption : {
					dir : "left", position : {
						top : 8
					}
				}, con : "body", hasCloseBtn : false, position : {
					my : "center", at : "center", of : "#tipcon"
				}, css : {
					width : "20"
				}
			});
			return t;
		};

		// 定义一个验证对象
		var d = new validate({
			con: "#zhangTaoForm",
			// 验证容器
			ntip: ntip,
			onSubmit: "#addBtn" // 提交按钮
		});

		// 设置拼装规则: 这里加上各个验证规则
		d.setValidateRule({ qymc: ["isBlank", "checkLen"] });
		d.setValidateRule({ bwb: ["isBlank", "checkLen"] });
		d.setValidateRule({ qyYear: ["isBlank", "checkLen"] });
		d.setValidateRule({ qyMonth: ["isBlank", "checkLen"] });
		d.setValidateRule({ kzzd: ["isBlank", "checkLen"] });
		d.setValidateRule({ nsrmc: ["isBlank", "checkLen"] });
		d.setValidateRule({ nsrcbh: ["isBlank", "checkLen"] });

	
		// 注册保存按钮事件
		d.bind("onsubmit", function() {
			if (confirm('确定提交？')) {
				// 序列化表单参数
				var serializedForm = $("#zhangTaoForm").serialize();
				$.post("${ctx}/zhangTao/edit", serializedForm, function(result) {
					if ("succ" == result) {
						alert("操作成功");
						parent.replaceByUrl('/login/toztWelcome');
						parent.layerClose(window.name);
					} else {
						alert(result);
					}
				},
				"json");
			}
		});
	});
	</script>
</body>
</html>